package frame.networks.tables.sdn;

import java.util.List;

import javax.swing.table.DefaultTableModel;

import model.components.networks.sdn.SdnNetwork;

@SuppressWarnings("serial")
public class SdnTableModel extends DefaultTableModel
{
	private List< SdnNetwork > sdnNetworks;
	public List< SdnNetwork > getSdnNetworks(){ return sdnNetworks; }
	public void setSdnNetworks( List< SdnNetwork > sdnNetworks ){ this.sdnNetworks = sdnNetworks; }
	
	public SdnTableModel( String[] columnNames, int rowCount, List< SdnNetwork > sdnNetworks )
	{
		super( columnNames, rowCount );
		
		this.setSdnNetworks( sdnNetworks );
	}
	
	@Override
	public boolean isCellEditable( int x, int y )
	{
		return false;
	}

	public void refresh()
	{
		this.setRowCount( 0 );
		
		for( SdnNetwork sdnNetwork: this.getSdnNetworks() )
			this.addRow( new Object[]{ sdnNetwork.getName(), sdnNetwork.getState() } );
	}
	
}
